home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7826 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  919 b 

  1. Path: gryphon.phoenix.net!usenet
  2. From: brucew@phoenix.net (Bruce Wedding)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: changing strings via pointers
  5. Date: Thu, 29 Feb 1996 02:54:42 GMT
  6. Organization: BranPaul Systems
  7. Message-ID: <4h34jv$1t4@gryphon.phoenix.net>
  8. References: <1996Feb22.125436.25503@leeds.ac.uk> <4gls59$rct@clarknet.clark.net>
  9. NNTP-Posting-Host: dial125.phoenix.net
  10. X-Newsreader: Moe's Newsreader    
  11.  
  12. In comp.lang.c
  13. yom@clark.net (yom) wrote:
  14.  
  15. >You can use strchr string function to get the pointer to a newline
  16. >character in your character array, and set what the pointer points
  17. >to to NULL (0).
  18. >
  19. >    char *b;
  20. >    if (b = strchr(buffer,'\n'))
  21. >        *b = 0;
  22.  
  23. or you could simplify and use strtok(buffer, "\n");
  24.  
  25.  
  26. Bruce D. Wedding                        Have Compiler, Will Travel!
  27.               Perspicacious Programming Performed Promptly
  28. Katy, Texas, USA, Planet Earth, Milkyway Galaxy, Known Universe
  29.  
  30.